﻿var displayTimer; // Manages WebGL rendering order

$(document).ready(function () {    
    $('#PDBBrowse').change(PDBChange);

    //Function for reading .pdb files.
    function PDBChange(evt) {
        var file = evt.target.files[0];

        if (!file) {
            alert("Failed to load file");
        }

        else {

            var fr = new FileReader();

            fr.onload = function (evt) {
                var text = evt.target.result;

                parsePDB(text);

                displayTimer = 0; // Informs WebGL to delete the old scene and draw a new one

                $('#display').removeAttr("disabled");
                $('#sequence').removeAttr("disabled");
                $('#Euler').removeAttr("disabled");

                $("#stepSize").val(1);
            }

            fr.readAsText(file);
        }
    }
});